package com.parser.resume;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;

public class HeadingFrequency {
	public static void main(String[] a) {
		// ArrayList<ResumeParser> list = new ArrayList<ResumeParser>();
	}
}

class Heading {
	ArrayList<String> headings;

	public Heading() {
		headings = new ArrayList<String>();
	}

	public void addHeading(String heading) {
		for (String existingHeading : headings) {
			if (existingHeading.equals(heading)) {
				return;
			}
			headings.add(heading);
		}
	}

	private ArrayList<String> removeDuplicates(ArrayList<String> list) {
		HashSet<String> set = new HashSet<String>(list);
		list.clear();
		list.addAll(set);
		return list;
	}

	public void addHeadings(ArrayList<String> headingsList) {
		for (String heading : headingsList) {
			headings.add(heading);
		}
		// remove duplicates
		headings = removeDuplicates(headings);
	}

	public boolean hasHeading(String heading) {
		for (String existingHeading : headings) {
			if (existingHeading.equals(heading)) {
				return true;
			}
		}
		return false;
	}
}

class Resume1 {
	String id;
	ArrayList<String> headings;
	String content;

	public Resume1(String text) {
		id = UUID.randomUUID().toString();
		headings = new ArrayList<String>();
		this.content = text;
	}

	public String getId() {
		return id;
	}

	public ArrayList<String> getHeadings() {
		return headings;
	}

	public boolean hasHeading(String heading) {
		for (String existingHeading : headings) {
			if (existingHeading.equals(heading)) {
				return true;
			}
		}
		return false;
	}

	public void parseResume() {
		// parse and obtain headings
		// get layouts and positions
		// get name, phone, email, etc.
		parseHeadings();
	}

	private void parseHeadings() {

	}
}
